﻿using System;

namespace diantou.web.enterprise
{
    /// <summary>
    /// 答卷
    /// </summary>
    /// <typeparam name="viewType"></typeparam>
    abstract class report<viewType> : view<viewType>
        where viewType : report<viewType>
    {
        /// <summary>
        /// 考试人员
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        protected diantou.examDataAccess.examUser user;
        /// <summary>
        /// 考试
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        protected diantou.examDataAccess.exam exam;
        /// <summary>
        /// 是否判卷人员可访问页面
        /// </summary>
        protected override bool isReviewerPage
        {
            get { return true; }
        }
        /// <summary>
        /// 是否显示判卷按钮
        /// </summary>
        protected bool isShowButton
        {
            get
            {
                return user.ReviewUserId == 0 && exam.UserId != currentUserId;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        protected bool loadView(int userId)
        {
            if (userId == 0)
            {
                checkSearchEngine(null, webConfig.NotFound404);
                return false;
            }
            user = diantou.examDataAccess.clientCache.GetExamUser(userId, currentUser);
            if (user != null)
            {
                exam = diantou.examDataAccess.clientCache.Exam[user.ExamId];
                return true;
            }
            AjaxResponse(webConfig.NotFound404);
            return false;
        }
    }
    /// <summary>
    /// 答卷
    /// </summary>
    [fastCSharp.code.cSharp.webView(IsPage = false, IsPool = true)]
    partial class report : report<report>
    {
        /// <summary>
        /// 用户提交记录
        /// </summary>
        private diantou.examDataAccess.examJudge.judgeSimilarity[] judges
        {
            get { return diantou.examDataAccess.tcpCall.examJudge.getJudges(user.Id, true); }
        }
    }
}
